Release 10.1A: OpenEdge Development:
.NET Open Clients


Persistent Procedure Sample

Example 8–10 shows a persistent procedure for the OpenAPI:

Example 8–10: Persistent procedure 4GL for the OpenAPI
DEFINE INPUT PARAMETER custNum AS INTEGER NO-UNDO. 
... 
FUNCTION GetTotalOrdersByNumber RETURNS INTEGER (threshold AS DECIMAL):  
... 
END. 
... 

Example 8–11 shows an OpenAPI code to run a persistent procedure:

Example 8–11: OpenAPI code to run the persistent procedure
namespace BigOrderInfoClient  { 
  using Progress.Open4GL; 
  using Progress.Open4GL.Proxy; 
  public  class samplecode         { 
    public static void PersistentProcedure()  { 
      // Connect to the AppServer 
      Connection myConn = new Connection("AppServer://localhost/asbroker2", 
                                         "", "", ""); 
      OpenAppObject openAO = new OpenAppObject(myConn, "mySvc"); 
      // Run the persistent Procedure 
      // First set up parameters 
      ParamArray parms = new ParamArray(1); 
      System.Int32 custNum = 3; 
      // Set up input parameters 
      parms.AddInteger(0, custNum, ParamArrayMode.INPUT); 
      // Run procedure 
      OpenProcObject openPO = openAO.CreatePO("OrderInfo/CustomerOrder.p", 
                                              parms); 
      // Call UDF 
      // First set up parameters 
      System.Decimal retVal; 
      int Threshold = 1000; 
      parms.Clear(); // Clear ParamArray for next call 
      // Set up input parameters 
      parms.AddDecimal(0, Threshold, ParamArrayMode.INPUT); 
      // Set up return type 
      parms.ReturnType = Parameter.PRO_DECIMAL; 
      // Run procedure 
      openPO.RunProc("GetTotalOrdersByDollar", parms); 
      // Get return value 
      retVal = (System.Decimal)parms.ReturnValue; 
      openPO.Dispose(); 
      openAO.Dispose(); 
    } 
  } 
} 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095